home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / iaca101.zip / IACATALK.DOC < prev    next >
Text File  |  1992-02-04  |  6KB  |  128 lines

  1.                 IACATALK version 1.01 Feb 4, 1992
  2.        "Talking" between CONFIG.SYS and AUTOEXEC.BAT through the
  3.                  Inter-Application Communications Area
  4.  
  5. by Robert W. Babcock
  6.    (BIX: rbabcock        Internet: peprbv@cfaamp.harvard.edu
  7.     BITNET: babcock@cfa         or babcock@cfa.harvard.edu)
  8.    WSS Division of DDC
  9.    4 Reeves Road
  10.    Bedford, MA  01730
  11.    USA
  12.    617-275-1183
  13.  
  14. I have about 10 different system configurations, each with its own CONFIG.SYS
  15. and AUTOEXEC.BAT, and I reconfigure by copying the appropriate files into the
  16. root directory and rebooting.  The problem is, the AUTOEXEC files aren't very
  17. different, and I often find myself editing all of them to install the same
  18. change.  What I really wanted was a way for AUTOEXEC.BAT to make decisions
  19. based on which CONFIG.SYS file was loaded so that I could use a single AUTOEXEC
  20. file.  DOS doesn't provide any obvious way of doing this, but I have found a
  21. reasonably portable way.
  22.  
  23. There are 16 bytes at address 40:f0 called the Inter-Application Communications
  24. Area (IACA).  These can safely be modified by any program, but according to
  25. Dave Williams DOSREF, the only applications which actually use them are the 
  26. Time Mark program included with some versions of the Norton Utilities, Turbo
  27. Power's FMARK and the BRIEF editor.  I have written a device driver which
  28. sticks a string into the IACA, then exits without using any memory.  A
  29. companion program reads the string out of the IACA and assigns it to an
  30. environment variable in the master environment.  This can be one of the first
  31. things done in AUTOEXEC.BAT, so there is little danger of the IACA being
  32. overwritten before it is read.
  33.  
  34. IACAFILL.SYS is the device driver.  In CONFIG.SYS, include a line
  35.  
  36.    DEVICE=[path]IACAFILL.SYS string
  37.  
  38. where string is the characters to be saved.  If more than 16 characters are
  39. found, the excess will be ignored.  Blanks are not allowed (a blank ends the
  40. string as far as IACAFILL is concerned) and DOS may convert the string to
  41. upper case.  (DOS 5 does this; I haven't tested other DOS versions.)
  42. Interestingly, Quarterdeck's DEVICE.COM which loads a device driver in a
  43. DesqView window does not force the arguments to upper case.  IACAFILL does not
  44. remain resident, so there is no point in loading it high.  It is also smaller
  45. than one 512 byte disk sector, so there is no point in beating on the code to
  46. try and make it smaller.
  47.  
  48. IACAREAD.EXE is the program which reads the saved string.  Include a line in
  49. AUTOEXEC.BAT
  50.  
  51.    IACAREAD variable_name
  52.  
  53. where variable_name is the name of the environment variable to be set.
  54. IACAREAD has the same effect as the DOS command
  55.  
  56.    SET variable_name=string
  57.  
  58. The environment variable can be referred to in a BAT file as %variable_name%.
  59. To avoid syntax errors if the SET has failed for some reason, it is best to
  60. prepend some character and test the combined string as is done in the example
  61. below.  If IACAREAD fails, it probably means that there was not enough
  62. environment space left to add the string.  IACAREAD is relatively large, even
  63. after being processed by an executable shrinker such as PKLite, LZEXE or DIET
  64. because it includes C library routines.  Anyone want to rewrite it in assembler?
  65.  
  66. Usage example:
  67.  
  68. CONFIG.SYS
  69.    DEVICE=c:\DOS\DRIVERS\IACAFILL.SYS GCC
  70.  
  71. AUTOEXEC.BAT
  72.    IACAREAD SYSTYPE
  73.     if NOT /%SYSTYPE% == /GCC goto skipgcc
  74.       rem only set all this stuff if using GCC
  75.       set gccbin=d:/gpp/bin
  76.       set gccinc=d:/gpp/include
  77.       set gcclib=d:/gpp/lib
  78.       set gcctmp=h:/
  79.       set go32=ansi driver d:/gpp/drivers/ati.grd gw 1024 gh 768
  80.       set bison_simple=d:/gpp/lib/bison.simple
  81.       set bison_hairy=d:/gpp/lib/bison.hairy
  82.       set flex_skeleton=d:/gpp/lib/flex.skeleton
  83.    :skipgcc
  84.    ...
  85.  
  86. Debugging
  87.  
  88. If the expected environment variable doesn't get set, the first thing to do is
  89. to use DEBUG to examine the IACA using the command
  90.      D 40:f0 L 16
  91. In particular, make sure that the string has the expected case.  (You might
  92. also do this before putting IACAFILL.SYS into CONFIG.SYS on a machine which
  93. is not fully IBM compatible.  If all 16 bytes are not zero, IACAFILL is likely
  94. to fail or cause something else to fail.)  The other thing to check is whether
  95. you have enough environment space.  I use Quarterdeck's Manifest to do this,
  96. but I'm sure there are many alternatives.
  97.  
  98. Credits
  99.  
  100. The code for manipulating the master environment was written by John Lowenthal
  101. (BIX: jlowenthal) and donated by OPENetwork to the public domain.  The routine
  102. for finding the master environment traces back to a message posted on BIX by
  103. P. Maupin.
  104.  
  105. Distribution terms and disclaimer
  106.  
  107. IACAFILL and the main program for IACAREAD are copyright 1991 by R. W. Babcock
  108. and WSS Division of DDC.  Source code is included in the package and is freely
  109. distributable.  Unlimited noncommercial use of this code is authorized.  Since
  110. I'm not asking any for money, I also disclaim any responsibility for anything
  111. this software may do.  It works for me, and I'll probably attempt to fix any
  112. bugs that are reported.  The most likely way you could get in trouble is by
  113. adding the device driver to CONFIG.SYS on your hard disk, then finding out that
  114. it interacts with something else in your configuration and crashes on boot.
  115. Either test it first from a bootable floppy, or make sure that a bootable
  116. floppy is available before you fiddle with CONFIG.SYS.  (You really should
  117. have such a floppy in any case.)
  118.  
  119. Revision history
  120.  
  121. Nov. 11, 1991 - initial 1.0 beta release
  122.  
  123. Feb 4, 1992 - 1.01 final release.  Only changes are minor documentation
  124.    corrections and removal of "beta" designation.  SYS and EXE files are
  125.    unchanged.  Also note with this release that the Dec. 17, 1991 PC Magazine
  126.    Languages column has a pair of programs which share information through the
  127.    IACA.
  128.